<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of DateEarlier_Validator
 *
 * @author johnnypark
 */
class Fkb_Validate_DateEarlier extends Zend_Validate_Abstract
{

    const MSG = 'date';

    protected $_messageTemplates = array(
	self::MSG => "'%value%' liegt in der Zukunft"
    );

    public function isValid($date)
    {
	try
	{
	    $date = new Zend_Date($date);
	} catch (Exception $e)
	{
	    return false;
	}

	$this->_setValue($date);
	$now = Zend_Date::now();

	if ($date->isEarlier($now))
	{
	    return true;
	} else
	{
	    $this->_error(self::MSG);
	    return false;
	}
    }

}

?>
